<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn" xml:lang="zh-cn">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="步骤5：注册MySQL/MariaDB/GreatSQL数据库">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="mysql-0009.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="30-OceanProtect 备份一体机 1.5.0-1.6.0 帮助中心">
<meta name="DC.Publisher" content="20240320">
<meta name="documenttype" content="usermanual">
<meta name="prodname" content="csbs">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="mysql-0016">
<meta name="DC.Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>步骤5：注册MySQL/MariaDB/GreatSQL数据库</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="mysql-0016"></a><a name="mysql-0016"></a>

<h1 class="topictitle1">步骤5：注册MySQL/MariaDB/GreatSQL数据库</h1>
<div><p>当MySQL/MariaDB/GreatSQL数据库所在主机安装ProtectAgent后，<span>OceanProtect</span>会自动发现MySQL/MariaDB/GreatSQL数据库主机，您需要在管理界面上注册主机上的数据库，以对其进行保护或将其作为恢复目标。</p>
<div class="section"><h4 class="sectiontitle">背景信息</h4><p><span>OceanProtect</span>支持备份<span>MySQL/MariaDB</span>/GreatSQL数据库以及其他自定义数据库，不支持备份系统数据库<strong>information_schema</strong>、<strong>performance_schema</strong>、<strong>sys</strong>和<strong>mysql</strong>。因此不支持注册系统数据库。</p>
</div>
<div class="section"><h4 class="sectiontitle">前提条件</h4><div class="p">注册MySQL/MariaDB/GreatSQL集群实例前，请确保集群中每个节点已进行注册，否则未注册的节点无法备份数据，在恢复场景下，会造成恢复时间点的用户数据不一致。<div class="note"><img src="public_sys-resources/note_3.0-zh-cn.png"><span class="notetitle"> </span><div class="notebody"><p>要求集群中所有节点的数据同步。</p>
</div></div>
</div>
</div>
<div class="section"><h4 class="sectiontitle">注册MySQL/MariaDB/GreatSQL单实例</h4><ol><li><span>选择<span class="uicontrol" id="mysql-0016__zh-cn_topic_0000001839142377_uicontrol189688153618">“<span id="mysql-0016__zh-cn_topic_0000001839142377_text148961988368">保护</span> &gt; 数据库 &gt; MySQL/MariaDB/GreatSQL”</span>。</span></li><li><span>选择<span class="uicontrol">“<span>实例</span>”</span>页签。</span></li><li><span>单击<span class="uicontrol">“<span>注册</span>”</span>，注册<span>MySQL/MariaDB</span>/GreatSQL。</span><p><div class="note"><img src="public_sys-resources/note_3.0-zh-cn.png"><span class="notetitle"> </span><div class="notebody"><p>MySQL/GreatSQL集群环境下的所有实例不能用于单实例注册。</p>
</div></div>
</p></li><li><span><span class="uicontrol">“<span>类型</span>”</span>选择<span class="uicontrol">“<span>单实例</span>”</span>。</span></li><li><span>配置数据库实例及其认证信息。</span><p><p>相关参数说明如<a href="#mysql-0016__zh-cn_topic_0000001311214069_table241515964115">表1</a>所示。</p>

<div class="tablenoborder"><a name="mysql-0016__zh-cn_topic_0000001311214069_table241515964115"></a><a name="zh-cn_topic_0000001311214069_table241515964115"></a><table cellpadding="4" cellspacing="0" summary="" id="mysql-0016__zh-cn_topic_0000001311214069_table241515964115" frame="border" border="1" rules="all"><caption><b>表1 </b>MySQL/MariaDB/GreatSQL单实例注册信息</caption><colgroup><col style="width:25.629999999999995%"><col style="width:74.37%"></colgroup><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="25.629999999999995%" id="mcps1.3.4.2.5.2.2.2.3.1.1"><p>参数</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="74.37%" id="mcps1.3.4.2.5.2.2.2.3.1.2"><p>说明</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.4.2.5.2.2.2.3.1.1 "><p><span>名称</span></p>
</td>
<td class="cellrowborder" valign="top" width="74.37%" headers="mcps1.3.4.2.5.2.2.2.3.1.2 "><p>自定义实例名称。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.4.2.5.2.2.2.3.1.1 "><p><span>主机</span></p>
</td>
<td class="cellrowborder" valign="top" width="74.37%" headers="mcps1.3.4.2.5.2.2.2.3.1.2 "><p>选择要注册的数据库主机。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.4.2.5.2.2.2.3.1.1 "><p>添加访问MySQL地址</p>
</td>
<td class="cellrowborder" valign="top" width="74.37%" headers="mcps1.3.4.2.5.2.2.2.3.1.2 "><p>访问MySQL服务的IP地址。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.4.2.5.2.2.2.3.1.1 "><p><span>端口</span></p>
</td>
<td class="cellrowborder" valign="top" width="74.37%" headers="mcps1.3.4.2.5.2.2.2.3.1.2 "><p>Linux环境下，界面显示为端口号，默认为3306。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.4.2.5.2.2.2.3.1.1 "><p><span>用户名</span></p>
</td>
<td class="cellrowborder" valign="top" width="74.37%" headers="mcps1.3.4.2.5.2.2.2.3.1.2 "><p>请填写<a href="mysql-0010.html">步骤1：开启MySQL/MariaDB/GreatSQL数据库权限</a>创建的用户名。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.4.2.5.2.2.2.3.1.1 "><p><span>密码</span></p>
</td>
<td class="cellrowborder" valign="top" width="74.37%" headers="mcps1.3.4.2.5.2.2.2.3.1.2 "><p>用户名密码。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.4.2.5.2.2.2.3.1.1 "><p>字符集</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><p>仅在1.6.0及后续版本展示该参数。</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="74.37%" headers="mcps1.3.4.2.5.2.2.2.3.1.2 "><p>数据库字符集。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.4.2.5.2.2.2.3.1.1 "><p>MySQL配置文件路径</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><p>仅在1.5.0.SPC16及后续版本展示该参数。</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="74.37%" headers="mcps1.3.4.2.5.2.2.2.3.1.2 "><p>如果MySQL配置文件存放路径为非默认路径，请填入MySQL配置文件路径。</p>
<p>查询配置文件的默认路径方法如下：</p>
<ol type="a"><li>登录数据库主机。</li><li>执行以下命令，以查找my.cnf配置文件为例：<pre class="screen">mysql --help | grep <em>'</em><em>my.cnf'</em></pre>
</li></ol>
</td>
</tr>
</tbody>
</table>
</div>
</p></li><li><span>单击<span class="uicontrol">“确定”</span>。</span></li></ol>
</div>
<div class="section"><h4 class="sectiontitle">注册MySQL/MariaDB/GreatSQL集群实例</h4><ol><li><span>注册集群。</span><p><ol type="a"><li>在MySQL/MariaDB/GreatSQL页面选择<span class="uicontrol">“<span>集群</span>”</span>页签。</li><li>单击<span class="uicontrol">“<span>注册</span>”</span>。</li><li>在<span class="uicontrol">“<span>注册</span>”</span>页面，自定义集群名称并选择类型和集群节点。<div class="p">相关参数说明如<a href="#mysql-0016__table8422135145120">表2</a>。
<div class="tablenoborder"><a name="mysql-0016__table8422135145120"></a><a name="table8422135145120"></a><table cellpadding="4" cellspacing="0" summary="" id="mysql-0016__table8422135145120" frame="border" border="1" rules="all"><caption><b>表2 </b>注册集群参数说明</caption><colgroup><col style="width:17.18%"><col style="width:82.82000000000001%"></colgroup><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="17.18%" id="mcps1.3.5.2.1.2.1.3.2.2.2.3.1.1"><p>参数</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="82.82000000000001%" id="mcps1.3.5.2.1.2.1.3.2.2.2.3.1.2"><p>说明</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="17.18%" headers="mcps1.3.5.2.1.2.1.3.2.2.2.3.1.1 "><p><span>名称</span></p>
</td>
<td class="cellrowborder" valign="top" width="82.82000000000001%" headers="mcps1.3.5.2.1.2.1.3.2.2.2.3.1.2 "><p>自定义集群名称。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="17.18%" headers="mcps1.3.5.2.1.2.1.3.2.2.2.3.1.1 "><p><span>类型</span></p>
</td>
<td class="cellrowborder" valign="top" width="82.82000000000001%" headers="mcps1.3.5.2.1.2.1.3.2.2.2.3.1.2 "><p>集群类型可选择主备复制、主主复制和<span style="color:#282B33;">PXC(Percona XtraDB Cluster)</span>类型。</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><p>GreatSQL仅支持选择主备复制类型。</p>
</div></div>
<ul><li>若选择<span class="uicontrol">“<span>主备复制</span>”</span>类型，则需要包含MySQL/MariaDB/GreatSQL主实例所在节点。</li><li>若选择<span class="uicontrol" style="color:#282B33;">“PXC(Percona XtraDB Cluster)”</span>类型，则需要包含MySQL/MariaDB集群实例所在节点。</li><li>若选择<span class="uicontrol">“主主复制”</span>类型，则需要包含MySQL/MariaDB集群实例所在节点。</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="17.18%" headers="mcps1.3.5.2.1.2.1.3.2.2.2.3.1.1 "><p><span>集群节点</span></p>
</td>
<td class="cellrowborder" valign="top" width="82.82000000000001%" headers="mcps1.3.5.2.1.2.1.3.2.2.2.3.1.2 "><p>MySQL/MariaDB/GreatSQL实例所在的主机。</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note"><img src="public_sys-resources/note_3.0-zh-cn.png"><span class="notetitle"> </span><div class="notebody"><ul><li>所选择的主机必须来源于同一集群。</li><li>当数据库集群类型为主备集群时，在 /etc/my.cnf配置文件中，如果有relay-log配置项，请设置relay_log_recovery取值为on与之配合使用（避免恢复失败）。</li></ul>
</div></div>
</div>
</li><li>单击<span class="uicontrol">“<span>确定</span>”</span>。</li></ol>
</p></li><li><span>注册集群实例。</span><p><ol type="a"><li>在MySQL/MariaDB/GreatSQL页面选择<span class="uicontrol">“<span>实例</span>”</span>页签。</li><li>单击<span class="uicontrol">“<span>注册</span>”</span>。</li><li><span class="uicontrol">“<span>类型</span>”</span>选择<span class="uicontrol">“<span>集群实例</span>”</span>。</li><li>输入实例名，选择集群。</li><li>单击“添加”，在弹出的添加对话框中添加集群实例下的所有节点。<p>相关参数说明如<a href="#mysql-0016__table1412426182113">表3</a>所示。</p>

<div class="tablenoborder"><a name="mysql-0016__table1412426182113"></a><a name="table1412426182113"></a><table cellpadding="4" cellspacing="0" summary="" id="mysql-0016__table1412426182113" frame="border" border="1" rules="all"><caption><b>表3 </b>集群实例的节点信息</caption><colgroup><col style="width:28.64%"><col style="width:71.36%"></colgroup><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="28.64%" id="mcps1.3.5.2.2.2.1.5.2.2.3.1.1"><p>参数</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="71.36%" id="mcps1.3.5.2.2.2.1.5.2.2.3.1.2"><p>说明</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.1 "><p><span>主机</span></p>
</td>
<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.2 "><p>选择集群下的主机节点。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.1 "><p>eAppMySQL地址</p>
</td>
<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.2 "><p>访问eAppMySQL服务IP地址。</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><p>GreatSQL不支持该参数。</p>
</div></div>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.1 "><p><span>端口</span></p>
</td>
<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.2 "><p>Linux环境下，界面显示为端口号，默认为3306。若集群类型选择为“主主复制”，则端口号为3307。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.1 "><p><span>用户名</span></p>
</td>
<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.2 "><p>请填写<a href="mysql-0010.html">步骤1：开启MySQL/MariaDB/GreatSQL数据库权限</a>创建的用户名。</p>
<p>使用root用户，登录MySQL/MariaDB/GreatSQL主机，执行如下命令登录MySQL/MariaDB/GreatSQL数据库。</p>
<pre class="screen">mysql -uroot -p<em>Password</em></pre>
<div class="p">执行如下命令给该用户开放远程连接权限。<pre class="screen">UPDATE mysql.user SET user.Host='%' where user.User='<em>用户名</em>';
flush privileges;</pre>
</div>
<p>回显如下，“host”为“%”，则表示已开放远程连接权限。</p>
<p><span><img src="zh-cn_image_0000002042950325.png"></span></p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.1 "><p><span>密码</span></p>
</td>
<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.2 "><p>数据库密码。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.1 "><p>字符集</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><p>仅在1.6.0及后续版本展示该参数。</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.2 "><p>数据库字符集。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.1 "><p>MySQL配置文件路径</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><p>仅在1.6.0及后续版本展示该参数。</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.3.5.2.2.2.1.5.2.2.3.1.2 "><p>如果配置文件非默认路径，如/etc/my.cnf等，请填入MySQL配置文件路径。</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li>单击<span class="uicontrol">“<span>确定</span>”</span>。</li></ol>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>父主题：</strong> <a href="mysql-0009.html">备份MySQL/MariaDB/GreatSQL数据库</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">版权所有 &copy; 华为技术有限公司</div></body>
</html>